import { getServiceList } from '../service/api'

/**
 * @Author: Wang chunsheng  email:2192138785@qq.com
 * @Date:   2024-02-07 21:48:04
 * @Last Modified by:   Wang chunsheng  email:2192138785@qq.com
 * @Last Modified time: 2024-02-15 19:32:48
 */
export const form = {
  'package_name': {
    'type': 'input',
    'label': '套餐名称'
  },
  'package_description': {
    'type': 'input',
    'label': '套餐描述'
  },
  'package_price': {
    'type': 'number',
    'label': '套餐价格'
  },
  service_id: {
    label: '选择服务',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: true,
      clearable: true
    },
    options: async data => {
      const res = await getServiceList()
      return res.data.server
    }
  },
  addons: {
    label: '选择应用',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: true,
      clearable: true
    },
    options: async data => {
      const res = await getServiceList()
      return res.data.addons
    }
  },
  group: {
    label: '选择服务',
    // 只需要在这里指定为 tree-select 即可
    type: 'tree-select',
    // 属性参考: https://vue-treeselect.js.org/
    attrs: {
      multiple: true,
      clearable: true
    },
    options: async data => {
      const res = await getServiceList()
      return res.data.group
    }
  }
}

export const order = ['package_name', 'package_description', 'package_price']

export const tableColumns = [{
  'label': '套餐ID',
  'prop': 'package_id'
}, {
  'label': '套餐名称',
  'prop': 'package_name'
}, {
  'label': '套餐描述',
  'prop': 'package_description'
}, {
  'label': '套餐价格',
  'prop': 'package_price'
}, {
  'label': '操作',
  'prop': 'action',
  'slot': 'action'
}]

export const filterInfo = {
  fieldList: {
    'label': '更新时间',
    'type': 'input',
    'value': 'DiandiSubscriptionPackage[update_time]'
  }

}

export const path = {
  index: 'diandi-subscription-package-list-index',
  update: 'diandi-subscription-package-list-update',
  create: 'diandi-subscription-package-list-create',
  api: '/diandi_subscription/package/list'
}

export const rowKey = 'package_id'
